import { isEmpty } from "@/utils/validate"
import { getActivityType } from "@/api/system/activity"

const useActivityStore = defineStore(
    'activity',
    {
        state: () => ({
            activityType: new Array(),
            selectedType:''
        }),
        actions: {
            // 获取活动类型
            async getType() {
                if (!this.activityType.value) {
                    let res = await getActivityType()
                    this.setType(res.data)
                }
                return this.activityType.value
            },
            // 设置活动类型
            setType(value) {
                this.activityType.value = value
            },
            //获取当前页面停留的活动类型
            getSelected(){
                return this.selectedType.value
            },
            setSelected(value){
                this.selectedType = value
            }
        }
    })

export default useActivityStore
